#pragma once
#include "cropctx.h"

#include "dib4source.h"

namespace png8crop
{
	class dib4cropctx :
		public cropctx
	{
	private:
		schemed_crop *scrops;

		schemed_crop *scropbuf_alloc;
		int num_scrops;


	public:
		dib4cropctx(dib4source *image);
		~dib4cropctx(void);
		
		void load_context_dib4(FILE* mnufile);

	private:
		dib4source * get_dib4image() { return (dib4source *) this->image; }
		
		static void on_numbuts_got(const void *value, const void *ctx);
	};
	
	struct parsectx
	{
		dib4cropctx *the_this;

		mnu_parser parser;
		
		int numbuts, numgroups;

		int *grouptypebuf_alloc;
		
		diam_list grouptype_diamlist;
		diam_info grouptype_diams[1];

		diam_list numbuts_diamlist;
		diam_info numbuts_diams[3];

		parsectx()
			:the_this(NULL),
			numbuts(0),
			numgroups(0),
			grouptypebuf_alloc(NULL)
		{}
	};
}